/* vim: expandtab tabstop=4
 */

#include <glib/glist.h>
#include <glib/gerror.h>
#include <glib/giochannel.h>
#include <stdio.h>


GList *fwadmin_list_ifaces_names(GError **error) {
    GList *list;
    GIOChannel *in;
    gchar *line;

    in = g_io_channel_new_file("/proc/net/dev", "r", error);

    if(in == NULL)
        return NULL;

    while(g_io_channel_read_line(in, &line, NULL, NULL, error) == G_IO_STATUS_NORMAL) {
        if(index(line, ":")) 
            g_list_append(list, (gchar *) g_strndup(line, index(line, ":") - line));
        g_free(line);
    }
    
    g_io_channel_shutdown(in, TRUE, NULL);

    return list;
}
